<script type="text/javascript">
 jQuery(document).ready(function($){
	 $('.add_media').click(function() {
		tb_show('Gallery Category Image', 'media-upload.php?type=image&amp;TB_iframe=true');
		return false;
	});
	
	window.send_to_editor = function(HTML)
	 {
		var src = $('img', HTML).attr('src');
		
		$('#catpic').val(src);
		$('#gallery_preview').attr('src', src);
		tb_remove();
	 }
 });
</script>

<?php if($term != 'wpnukes_gallery' && isset($_GET['action']) && $_GET['action'] == 'edit'): ?>
<tr class="form-field">
	<th valign="top" scope="row">
		<label for="catpic"><?php _e('Picture of the Category', $this->text_domain);?></label>
	</th>
	<td>
		<img src="<?php echo $image;?>" width="100" id="gallery_preview" />
		<input type="text" id="catpic" name="catpic" value="<?php echo $image;?>"/>
		<a title="Add Media" data-editor="content" class="button insert-media add_media left thickbox" href="<?php echo home_url();?>/wp-admin/media-upload.php?type=image&TB_iframe=1"><span class="wp-media-buttons-icon"></span> <?php _e('Add Media', $this->text_domain); ?></a>
	</td>
</tr>
<?php else: ?>
<div class="form-field">
	<label for="catpic"><?php _e('Picture of the Category', $this->text_domain);?></label>
	<img src="" width="100" id="gallery_preview" />
	<input type="text" value="" id="catpic" name="catpic">
	<a title="Add Media" data-editor="content" class="button insert-media add_media left" href="<?php echo home_url();?>/wp-admin/media-upload.php"><span class="wp-media-buttons-icon"></span> <?php _e('Add Media', $this->text_domain); ?></a>
</div>
<?php endif; 